package com.cy.pj.common.util;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

public class ServletUtil {

    public static HttpServletRequest getRequest(){
        ServletRequestAttributes requestAttributes=
                (ServletRequestAttributes)
                        RequestContextHolder
                        .getRequestAttributes();
        return requestAttributes.getRequest();
    }
    public static ServletRequestAttributes getRequestAttributes(){
        return (ServletRequestAttributes)
                RequestContextHolder
                .getRequestAttributes();
    }
}
